package com.withouther.robot.rainingrobot.util;

import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.MultimediaInfo;

import java.io.File;

/**
 * @ClassName VideoUtil
 * @Auther: tzq
 * @Date: 2020/7/30 20:59
 * @Description:
 */
public class VideoUtil {

    /**
     * 获取音频文件的时间(秒数)
     *
     * @return
     * @throws Exception
     * @throws Exception
     */
    public static int getFileTime(File file) throws Exception {
        it.sauronsoftware.jave.Encoder encoder = new Encoder();
        MultimediaInfo m;
        m = encoder.getInfo(file);
        return (int) (m.getDuration() / 1000);
    }
}
